package de.tum.beilmaier.im.client.view;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;

import de.tum.beilmaier.im.client.controller.ChatRoomController;
import de.tum.beilmaier.im.shared.model.ChatRoom;
import de.tum.beilmaier.im.shared.model.InstantMessage;

import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.cellview.client.CellList;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.dom.client.Style.Unit;
import com.gwtext.client.widgets.layout.VerticalLayout;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.TextBox;

public class ChatRoomWindow extends LayoutPanel {

	private TextBox sendBox = null;
	private Button sendButton = null;
	private ChatRoom chatRoom = null;
	private TextArea receiveArea = null;
	public ChatRoomWindow(ChatRoom chatRoom) {
		
		this.chatRoom = chatRoom;
		sendButton = new Button("Senden");
		add(sendButton);
		setWidgetLeftWidth(sendButton, 345.0, Unit.PX, 81.0, Unit.PX);
		setWidgetTopHeight(sendButton, 254.0, Unit.PX, 30.0, Unit.PX);
		
		sendBox = new TextBox();
		add(sendBox);
		setWidgetLeftWidth(sendBox, 37.0, Unit.PX, 284.0, Unit.PX);
		setWidgetTopHeight(sendBox, 250.0, Unit.PX, 34.0, Unit.PX);
		
		receiveArea = new TextArea();
		add(receiveArea);
		setWidgetLeftWidth(receiveArea, 37.0, Unit.PX, 284.0, Unit.PX);
		setWidgetTopHeight(receiveArea, 34.0, Unit.PX, 198.0, Unit.PX);
		
	}

	public ChatRoom getChatRoom() {
		return chatRoom;
	}

	public void setChatRoom(ChatRoom chatRoom) {
		this.chatRoom = chatRoom;
	}

	public TextBox getSendBox() {
		return sendBox;
	}

	public void setSendBox(TextBox sendBox) {
		this.sendBox = sendBox;
	}

	public Button getSendButton() {
		return sendButton;
	}

	public void setSendButton(Button sendButton) {
		this.sendButton = sendButton;
	}

	
	public TextArea getReceiveArea() {
		return receiveArea;
	}

	public void setReceiveArea(TextArea receiveArea) {
		this.receiveArea = receiveArea;
	}

	public void addSendButtonListener(ChatRoomController chatRoomController) {
		sendButton.addClickHandler(chatRoomController);
		
	}
}
